package com.atguigu.recursion;

public class RecursionTest {
    public static void main(String[] args) {
//        testPrint(5);

        int factorial = factorial(5);
        System.out.println("result:"+factorial);

    }

    public static void testPrint(int n){
        if(n>2){
            testPrint(n-1);
        }
        System.out.println("n="+n);
    }

    public static int factorial(int n){
        if(n>1){
            return n*factorial(n-1);
        }else{
            return 1;
        }
    }
}
